package com.practice.controller.admin;


import com.practice.common.result.Result;
import com.practice.pojo.admin.dto.LinkPageDTO;
import com.practice.pojo.admin.entity.Link;
import com.practice.service.admin.LinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author itcast
 * @since 2023-05-15
 */
@RestController
@RequestMapping("/ydd_link")
public class LinkController {

    @Autowired
    private LinkService linkService;

    //链接详情
    @GetMapping("/rowInfo")
    public Result linkDetail(Integer id){
        return linkService.linkDetail(id);
    }


    //链接删除
    @GetMapping("/del")
    public Result linkDelete(Integer id){
        return linkService.linkDelete(id);
    }


    //链接修改
    @PostMapping("/update")
    public Result linkUpdate(@RequestBody Link link){
        return linkService.linkUpdate(link);
    }

    //链接添加
    @PostMapping("/add")
    public Result linkAdd(@RequestBody Link link){
        return linkService.linkAdd(link);
    }


    //链接列表-分页查询
    @GetMapping("/list")
    public Result page(LinkPageDTO linkPageDTO){
        return linkService.pageList(linkPageDTO);
    }

}
